<?php
class Person extends AppModel {
	//var $name = 'People';
    
   // var $displayField = array("nombre", "apellido");
  
   
    var $displayField = "full_name"; 
    var $actsAs = array('MultipleDisplayFields' => array( 
        'fields' => array('nombre', 'apellido'), 
        'pattern' => '%s %s' 
    )); 

    
	var $validate = array(
		'nombre' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		

		'email' => array(
			'email' => array(
				'rule' => array('email'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		)/*,
        
    /*  'user_id' => array( 
            'user_id' => array(
                //'rule' => array('email'),
                //'message' => 'Your custom message here',
                'allowEmpty' => true,
                'required' => false,
                //'last' => false, // Stop validation after this rule
                //'on' => 'create', // Limit validation to 'create' or 'update' operations
            ), 
        ),*/    

	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed
   /* var $hasMany = array(
        'User' => array(
            'className' => 'User',
            'foreignKey' => 'id',
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '1', 
        )
    ); */ 

    var $belongsTo = array(
   
      'User' => array(
            'className' => 'User',
            'foreignKey' => 'user_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        ),
         'PersonRole' => array(
            'className' => 'PersonRole',
            'foreignKey' => 'person_role_id ',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        )
        
    );       
  /*
	var $hasMany = array(
		'Capacitation' => array(
			'className' => 'Capacitation',
			'foreignKey' => 'person_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'SupplierHistory' => array(
			'className' => 'SupplierHistory',
			'foreignKey' => 'person_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Task' => array(
			'className' => 'Task',
			'foreignKey' => 'person_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);


	var $hasAndBelongsToMany = array(
		'Capacitation' => array(
			'className' => 'Capacitation',
			'joinTable' => 'capacitations_people',
			'foreignKey' => 'person_id',
			'associationForeignKey' => 'capacitation_id',
			'unique' => true,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		),
		'Type' => array(
			'className' => 'Type',
			'joinTable' => 'people_type',
			'foreignKey' => 'person_id',
			'associationForeignKey' => 'type_id',
			'unique' => true,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		)
	); */



}
?>